<?php

namespace app\mall\ui\form;

use app\mall\enum\MAllStoreStatusEnum;
use app\mall\model\MallStoreLevelSetting;

/**
 * 门店管理表单
 */
class MallStoreForm
{
    public function name()
    {
        return [
            'type' => 'input',
            'title' => '门店名称',
            'field' => 'name',
            'validate' => [
                ['required' => true, 'message' => '不能为空']
            ]
        ];
    }

    public function logo()
    {
        return [
            'type' => 'uploadImage',
            'action' => config('thinkAdmin.upload_url'),
            'title' => 'LOGO',
            'field' => 'logo',
            'validate' => [
                ['required' => true, 'message' => '不能为空', 'type' => 'string']
            ]
        ];
    }

    public function status()
    {
        return [
            'type' => 'radio',
            'options' => MAllStoreStatusEnum::toZhArrayForSelect(),
            'title' => '状态',
            'field' => 'status',
            'validate' => [
                ['required' => true, 'message' => '不能为空']
            ]
        ];
    }

    public function level()
    {
        return [
            'type' => 'select',
            'options' => MallStoreLevelSetting::buildLevelOptions(true),
            'title' => '门店等级',
            'field' => 'level_flag',
            'validate' => [
                ['required' => true, 'message' => '不能为空']
            ]
        ];
    }

    public function region_names()
    {
        return [
            'type' => 'cityArea',
            'title' => '地区',
            'field' => 'region_names',
            'props' => [
                'showAllLevels' => false
            ]
        ];
    }

    public function address()
    {
        return [
            'type' => 'input',
            'title' => '地址',
            'field' => 'address',
        ];
    }

    public function business_hours()
    {
        return [
            'type' => 'input',
            'title' => '营业时间段',
            'field' => 'business_hours',
        ];
    }

    public function phone()
    {
        return [
            'type' => 'input',
            'title' => '客服电话',
            'field' => 'phone',
        ];
    }
}